﻿@model ArticleClassifyEntity
@using System.Text
@using XTeam.Core.Interface
@{
    ViewBag.Title = "ViewPage1";
    Layout = "../Shared/_layout.cshtml";
}
@section JsContent{
    <script type="text/javascript">
        $(function () {
            $("#classify > .tree").tree({ lines: true });
        });

        function addNew() {
        }

        function edit() {
        }
        function remove() {
        }

    </script>
}
@{
        
    Func<ArticleClassifyEntity, string> tree = null;

    tree = (ArticleClassifyEntity classify) =>
    {
        StringBuilder sb = new StringBuilder();


        if (classify.Children != null && classify.Children.Count > 0)
        {
            sb.AppendLine("<ul class='easyui-tree tree'>");

            foreach (ArticleClassifyEntity item in classify.Children)
            {
                sb.AppendLine("<li>");
                sb.AppendLine(string.Format("<span>{0}</span>", Html.ActionLink(item.ClassName, "ClassifyPost", new { classid = item.ClassId })));
                sb.AppendLine(tree(item));
                sb.AppendLine("</li>");
            }
            sb.AppendLine("</ul>");

        }
        return sb.ToString(); ;
    };
}
<div class="easyui-panel" title="文章分类管理" iconcls="icon-ok" tools="#tools">
    <div id="classify" style="padding: 5px">
        @Html.Raw(tree(Model))
    </div>
</div>
<div id="tools">
    <a href="#" title="新增" iconcls="icon-add" onclick=""></a><a href="#" title="修改" iconcls="icon-edit">
    </a><a href="#" title="删除" iconcls="icon-remove"></a>@*<a href="#" title="打印" iconcls="icon-print">
        </a>*@<a href="#" title="刷新" iconcls="icon-reload" onclick="location.reload(true)">
        </a><a href="#" title="帮助" iconcls="icon-help"></a>
</div>
